/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package AdvanceMath.R3;

import AdvanceMath.Vector3;

/**
 *
 * @author RomulusAaron
 */
public class Sphere {
    Vector3 pos;
    double radius;
    
    public Sphere(Vector3 pos, double radius){
        this.pos=pos;
        this.radius=radius;
    }
    
    public Sphere(double x, double y, double z, double radius){
        this.pos=new Vector3(x,y,z);
        this.radius=radius;
    }
    
    public double getVolume(){
        return ((4/3)*radius*radius*radius*Math.PI);
    }
    
    public double getSurfaceArea(){
        return (4*Math.PI*radius*radius);
    }
    
    public boolean isColiding(Sphere other){
        return pos.distanceSquared(other.pos) <= Math.pow(radius+other.radius,2);
    }
}
